package com.xz.dao.impl;

import com.xz.bean.Actress;
import com.xz.bean.Arzon;
import com.xz.dao.ArzonDao;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by YLZX-Z0107 on 2014/7/18.
 */
public class ArzonDaoImpl implements ArzonDao {
    public SqlSessionTemplate sqlSession;

    @Override
    public int saveArzon(Arzon arzon) {
        return sqlSession.insert(getClass().getName() + ".saveArzon", arzon);
    }

    @Override
    public int saveArzonImages(int aid, List<String> images) {
        Map param = new HashMap();
        param.put("aid", aid);
        param.put("images", images);
        return sqlSession.insert(getClass().getName() + ".saveArzonImages", param);
    }

    @Override
    public int saveArzonUU(Actress actress) {
        return sqlSession.insert(getClass().getName() + ".saveArzonUU",actress);
    }

    @Override
    public int saveArzonName(int aid, List<Integer> uids) {
        Map param = new HashMap();
        param.put("aid",aid);
        param.put("uids",uids);
        return sqlSession.insert(getClass().getName() + ".saveArzonName", param);
    }

    @Override
    public Actress getByName(String name) {
        return (Actress) sqlSession.selectOne(getClass().getName() + ".getByName",name);
    }

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }
}
